﻿@model CustomerAddressEditModel
@using SpotsHub.Gateway.Models.Customer;

@{
    var Address = Model.Address;
}
<div class="address-@Address.Id address-row row">
    <div class="address-info">
        @Html.ValidationSummary(false)
        @Html.HiddenFor(model => Model.Address.Id)
        @Html.HiddenFor(model => Model.Address.CountryId)
        <div class="col col-xs-3 col-sm-3 col-md-3 col-lg-3">
            <div class="info-label">
                @Html.RequiredHint()
                @Html.LabelFor(model => Model.Address.FirstName)
            </div>
            <div class="info-input">
                @Html.TextBoxFor(model => Model.Address.FirstName, new { id = "FirstName-" + Model.Address.Id.ToString()})
            </div>
        </div>
        <div class="col col-xs-3 col-sm-3 col-md-3 col-lg-3">
            <div class="info-label">
                @Html.RequiredHint()
                @Html.LabelFor(model => Model.Address.LastName)
            </div>
            <div class="info-input">
                @Html.TextBoxFor(model => Model.Address.LastName, new { id = "LastName-" + Model.Address.Id.ToString()})
            </div>
        </div>
        @if (Model.Address.StreetAddressEnabled)
        {
            <div class="col col-xs-6 col-sm-6 col-md-6 col-lg-6">
                <div class="info-label">
                    @if (Model.Address.StreetAddressRequired)
                    {
                        @Html.RequiredHint()
                    }
                    @Html.LabelFor(model => Model.Address.Address1)
                </div>
                <div class="info-input">
                    @Html.TextBoxFor(model => Model.Address.Address1, new { id = "Address1-" + Model.Address.Id.ToString()})
                </div>
            </div>
        }
        @if (Model.Address.CompanyEnabled)
        {
            <div class="col col-xs-6 col-sm-6 col-md-6 col-lg-6">
                <div class="info-label">
                    @if (Model.Address.CompanyRequired)
                    {
                        @Html.RequiredHint()
                    }
                    @Html.LabelFor(model => Model.Address.Company)
                </div>
                <div class="info-input">
                    @Html.TextBoxFor(model => Model.Address.Company, new { id = "Company-" + Model.Address.Id.ToString()})
                </div>
            </div>
        }
        @if (Model.Address.StreetAddress2Enabled)
        {
            <div class="col col-xs-6 col-sm-6 col-md-6 col-lg-6">
                <div class="info-label">
                    @Html.LabelFor(model => Model.Address.Address2)
                </div>
                <div class="info-input">
                    @Html.TextBoxFor(model => Model.Address.Address2, new { id = "Address2-" + Model.Address.Id.ToString()})
                </div>
            </div>
        }
        <div class="col col-xs-6 col-sm-6 col-md-6 col-lg-6">
            <div class="info-label">
                @Html.RequiredHint()
                @Html.LabelFor(model => Model.Address.Email)
            </div>
            <div class="info-input">
                @Html.TextBoxFor(model => Model.Address.Email, new { id = "Email-" + Model.Address.Id.ToString()})
            </div>
        </div>
        @if (Model.Address.ZipPostalCodeEnabled)
        {
            <div class="col col-xs-3 col-sm-3 col-md-3 col-lg-3">
                <div class="info-label">
                    @if (Model.Address.ZipPostalCodeRequired)
                    {
                        @Html.RequiredHint()
                    }
                    @Html.LabelFor(model => Model.Address.ZipPostalCode)
                </div>
                <div class="info-input">
                    @Html.EditorFor(model => Model.Address.ZipPostalCode, new { id = "ZipPostalCode-" + Model.Address.Id.ToString()})
                </div>
            </div>
        }
        @if (Model.Address.CityEnabled)
        {
            <div class="col col-xs-3 col-sm-3 col-md-3 col-lg-3">
                <div class="info-label">
                    @if (Model.Address.CityRequired)
                    {
                        @Html.RequiredHint()
                    }
                    @Html.LabelFor(model => Model.Address.City)
                </div>
                <div class="info-input">
                    @Html.EditorFor(model => Model.Address.City, new { id = "City-" + Model.Address.Id.ToString()})
                </div>
            </div>

        }
        @if (Model.Address.PhoneEnabled)
        {
            <div class="col col-xs-3 col-sm-3 col-md-3 col-lg-3">
                <div class="info-label">
                    @if (Model.Address.CellPhoneRequired)
                    {
                        @Html.RequiredHint()
                    }
                    @Html.LabelFor(model => Model.Address.CellPhoneNumber)
                </div>
                <div class="info-input">
                    @Html.TextBoxFor(model => Model.Address.CellPhoneNumber, new { id = "CellPhoneNumber-" + Model.Address.Id.ToString()})
                </div>
            </div>
            <div class="col col-xs-3 col-sm-3 col-md-3 col-lg-3">
                <div class="info-label">
                    @Html.LabelFor(model => Model.Address.PhoneNumber)
                </div>
                <div class="info-input">
                    @Html.TextBoxFor(model => Model.Address.PhoneNumber, new { id = "PhoneNumber-" + Model.Address.Id.ToString()})
                </div>
            </div>
        }
        @if (Model.Address.CountryEnabled)
        {
            <div class="col col-xs-3 col-sm-3 col-md-3 col-lg-3">
                <div class="info-label">
                    @Html.LabelFor(model => Model.Address.CountryId)
                </div>
                <div class="info-input">
                    @Html.TextBoxFor(model => Model.Address.CountryName, new { Class = "input-display", disabled = "disabled" })
                </div>
            </div>

        }
        @if (Model.Address.CountryEnabled && Model.Address.StateProvinceEnabled)
        {
            <div class="col col-xs-3 col-sm-3 col-md-3 col-lg-3">
                <div class="info-label">
                    @Html.LabelFor(model => Model.Address.StateProvinceId)
                </div>
                <div class="info-input">
                    @Html.DropDownListFor(model => Model.Address.StateProvinceId, Model.Address.AvailableStates, new { id = "StateProvinceId-" + Model.Address.Id.ToString()})
                </div>
            </div>
        }                              
    </div>

    <script type="text/javascript">
        @if (Model.IsShippingAddress)
        { 
            <text>
                $(".table-default a.default-shipping").removeClass("active");
                $(".address-@Address.Id .table-default a.default-shipping").addClass("active");
            </text>
        }
        @if (Model.IsBillingAddress)
        { 
            <text>
                $(".table-default a.default-billing").removeClass("active");
                $(".address-@Address.Id .table-default a.default-billing").addClass("active");
            </text>
        }
    </script>
    <div class="content-clear"></div>
</div>
